<?php

class Kd_Validation_Rule_Regex extends Kd_Validation_Rule_Base {

    private $_expression = NULL;

    public function  __construct() {
        parent::__construct();
    }

    public function getExpression(){
        return $this->_expression;
    }
    public function setExpression($value){
        $this->_expression = $value;
        return $this;
    }

    public function getType(){
        return 'regex';
    }

    public function check($value) {
        return preg_match($this->getExpression(), $value) > 0;
    }
}